<div class="weui-flex">
  <div class="weui-flex__item">
    <h2 class="d2-header" *ngIf="detail.id">修改记录</h2>
    <h2 class="d2-header" *ngIf="!detail.id">添加记录</h2>
  </div>
  <div class="weui-flex__item position-relative">
    <a href="javascript:" class="weui-btn weui-btn_warn position-absolute b30" *ngIf="detail.id" (click)="delete(detail.id)">删除</a>
  </div>
</div>


<form #detailFrom="ngForm">

  <div class="weui-cells__title">名称</div>
  <div class="weui-cells">
    <div class="weui-cell">
      <div class="weui-cell__bd">
        <input class="weui-input" type="text" placeholder="请输入物品名称" maxlength="64" [(ngModel)]="detail.name" required name="name">
      </div>
    </div>
  </div>

  <div class="weui-cells__title">仓库</div>
  <div class="weui-cells">
    <div class="weui-cell weui-cell_select">
      <div class="weui-cell__bd">
        <select class="weui-select" name="account" [(ngModel)]="detail.account.id">
          <option selected="" value="0">待定</option>
          <ng-container *ngFor="let item of accounts">
            <option [value]="item.id">{{item.name}}</option>
          </ng-container>
        </select>
      </div>
    </div>
  </div>

  <div class="weui-btn-area">
    <a class="weui-btn weui-btn_primary" (click)="save()" *ngIf="detailFrom.valid">确定</a>
    <a href="javascript:" class="weui-btn weui-btn_plain-primary weui-btn_plain-disabled" *ngIf="detailFrom.invalid">确定</a>
  </div>
</form>
